home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- CPEditTextX.h
-
- Constants and Macros for the PEditText Class
-
- Copyright © 1992-1993 Christopher R. Wysocki. All rights reserved.
-
- ******************************************************************************/
-
- #pragma once // Include this file only once
-
- /** Constants **/
-
- #define rItalicIBeamCursor 1225 // Resource ID of italic i-beam cursor
-
- #define kDefaultTabSpaces 4 // Default number of spaces per tab
-
- #define kStandardGapLength 512 // Standard length of insertion gap
-
- #define kDefaultBoundsWidth 4096 // Default width of bounds rectangle
-
- #define kHorizInset 2 // Pixel inset from left of frame
- #define kVertInset 0 // Pixel inset from top of frame
-
- #define kBackspace (Byte)'\b' // ASCII character codes
- #define kTab (Byte)'\t'
- #define kReturn (Byte)'\r'
- #define kLineFeed (Byte)'\n'
- #define kFormFeed (Byte)'\f'
- #define kSpace (Byte)' '
-
- #define kInvisSpace (Byte)'◊' // Characters for "show invisibles"
- #define kInvisTab (Byte)'Δ'
- #define kInvisReturn (Byte)'¬'
- #define kInvisLineFeed (Byte)'£'
- #define kInvisFormFeed (Byte)'ƒ'
- #define kInvisOther (Byte)'¿'
-
- // mnemonic constants for Boolean parameters
- enum {
- kEraseText = TRUE,
- kDontEraseText = FALSE,
- kUseSelection = TRUE,
- kDontUseSelection = FALSE
- };
-
- /** Macros **/
-
- #define SetLongPt(lp,x,y) (lp)->h = (x), \
- (lp)->v = (y);
-
- #define SetLongRect(lr,l,t,r,b) (lr)->left = (l), \
- (lr)->top = (t), \
- (lr)->right = (r), \
- (lr)->bottom = (b);
-
- #define IsArrowKey(c) ((c) == kLeftCursor || (c) == kRightCursor || \
- (c) == kUpCursor || (c) == kDownCursor)
-
- #define IsColorPort(p) (((CGrafPtr) p)->portVersion & 0xC000)
-
- #define HorizInset() (kHorizInset + frame.left - position.h * hScale)
- #define VertInset() (kVertInset + frame.top - position.v * vScale)
-
- #define HorizPixelExtent() ((bounds.right - bounds.left) * hScale)
- #define VertPixelExtent() ((bounds.bottom - bounds.top) * vScale)
-
- // The following macros provide equivalent inline replacements for
- // the standard methods defined in CPane. To make the object code
- // smaller but slighly slower, remove the following four #defines.
-
- #define FrameToQD(framePt,qdPt) \
- (qdPt)->h = (long)(framePt)->h - hOrigin + thePort->portRect.left, \
- (qdPt)->v = (long)(framePt)->v - vOrigin + thePort->portRect.top
-
- #define FrameToQDR(frameRect,qdRect) \
- FrameToQD(&topLeftL(*(frameRect)), &topLeft(*(qdRect))), \
- FrameToQD(&botRightL(*(frameRect)), &botRight(*(qdRect)))
-
- #define QDToFrame(qdPt,framePt) \
- (framePt)->h = (long) (qdPt).h + hOrigin - thePort->portRect.left, \
- (framePt)->v = (long) (qdPt).v + vOrigin - thePort->portRect.top
-
- #define QDToFrameR(qdRect,frameRect) \
- QDToFrame(topLeft(*(qdRect)), &topLeftL(*(frameRect))), \
- QDToFrame(botRight(*(qdRect)), &botRightL(*(frameRect)))
-
- /** Prototypes **/
-
- #if __cplusplus
- extern "C" {
- #endif
- void AsmDrawLineRange(Ptr textP, short numChars, short tabWidth, Ptr gapP, long gapLength, Point startPt, Boolean showInvisibles);
- void AsmMeasureTextWidths(Ptr textP, short numChars, short tabWidth, Ptr gapP, long gapLength, short *widthsP, short maxWidth);
- #if __cplusplus
- };
- #endif
-